import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.5
import gtModule 1.0

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    Button {

        text: gtjob.students[0].name
        onClicked: {
            let students = gtjob.students
            for (let i = 0; i < students.length; ++i)
                console.log(students[i].name, ' ', students[i].age, gtjob.squad.name)

            //text: gtjob.squad.name
        }
    }

    GtJob {
        id: gtjob
        students: [
            GtPerson {
                name: 'zhangsan'
                age: 11
            },
            GtPerson {
                name: 'lisi'
                age: 12
            },
            GtPerson {
                name: 'wangwu'
                age: 13
            }
        ]


        //会调用getSquad
        squad {
            name: 'zhaoliu'
            age: 14
        }


        //会调用setSquad
//        squad : GtPerson {
//            name: 'zhaoliu'
//            age: 14
//        }
    }
}
